<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>志愿之星</title>
    <link rel="stylesheet" type="text/css" href="__CSS__api.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__aui.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__dropload.css" />

    <style>
        .warrp{
            width: 100%;
            height: 100%;
            padding: 0.8rem 0.75rem 0 0.75rem;
        }
        .card{
            padding: 0 5px 0 5px;
            width: 100%;
            height: 100%;
            background-color: #fff;
            border-radius:5px;
        }
        .top{
            width: 100%;
            height: 100%;
            height: 4.05rem;
            display: flex;
        }
        .under{
            width:100%;
            height:100%;
            padding: 0.75rem 0.75rem 0.75rem 0.8rem;
        }
        .font{
            width: 100%;
            height: 2rem;
            text-align: justify;
            font-size:0.75rem;
            line-height:1rem;
        }
        .head{
            padding: 0.775rem 0.8rem 0.75rem 0.75rem;
        }
        .head img{
            width: 2.5rem;
            height: 2.5rem;
        }
        .username{
            margin-top: 1.2rem;
            font-size:0.8rem;
            color:rgba(51,51,51,1);
            line-height:0.6rem;
        }
        .tuandui{
            margin-top: 0.5rem;
            font-size:0.65rem;
            color:rgba(179,179,179,1);
            line-height:0.6rem;
        }
    </style>
    <style>
        .aui-bar-nav .aui-iconfont {
            position: relative;
            font-family: "aui_iconfont" !important;
            font-size: 0.75rem;
            color: #E73C5C;
            font-style: normal;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            height: 2.4rem;
        }

        .aui-bar-nav {
            background-color: #fff;
        }

        .aui-icon-tu {
            height: 2.4rem;
            width: 49px;
            background: url('__IMG__left.png') no-repeat 0.5rem center;
            background-size: 22px 22px;
        }

        .aui-bar-nav .aui-pull-right {
            padding-right: 0.75rem;
        }

        .aui-bar-nav .aui-title {
            font-size: 0.9rem;
            color: #333333;
            font-weight: 500;
        }
    </style>
</head>

<body>
<header class="aui-bar aui-bar-nav underLine" style="padding-top:25px;" id="header">
    <a class="aui-pull-left" tapmode="active" onclick="history.go(-1)"> <span class="aui-iconfont aui-icon-tu"> </span> </a>
    <div class="aui-title">志愿者之星</div>
</header>
<div class="warrp">
    <div class="upOrDown">
        <div class="upOrDown_data">
            {volist name="list"  id="vo"}
            <div class="card" style="margin-top:0.8rem;" onclick="fnStar(this)" idd="{$vo.user_id}">
                <div class="top underLine">
                    <div class="head">
                        <img src="{$vo.user_image}">
                    </div>
                    <div class="name">
                        <div class="username">
                            {$vo.user_username}
                        </div>
                        <div class="tuandui">
                            {$vo.mechanism}
                        </div>
                    </div>
                </div>
                <div class="under " >
                    <div class="font aui-ellipsis-2">
                        参加活动：{$vo.activity}
                    </div>
                </div>
            </div>
            {/volist}
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="__JS__jquery.min.js"></script>
<script type="text/javascript" src="__JS__dropload.min.js"></script>
<script type="text/javascript" src="__JS__api.js"></script>
<script type="text/javascript" src="__JS__tt.js"></script>
<script type="text/javascript" src="__JS__doT.min.js"></script>
<script type="text/javascript" src="__JS__aui-lazyload.js"></script>

<script type="text/javascript">
    // 志愿之星
    function fnStar(el){
        var idd=$api.attr(el,'idd');

        location.href='{:url("First/volunteerdetail")}?user_id='+idd;
    }
</script>
<script>
    var page = 1;

    /**
     * 上拉加载，下拉刷新
     */
    var dropload = $('.upOrDown').dropload({
        scrollArea : window,
        autoLoad : true,
//        domUp : {
//            domClass   : 'dropload-up',
//            domRefresh : '<div class="dropload-refresh">↓下拉刷新-自定义内容</div>',
//            domUpdate  : '<div class="dropload-update">↑释放更新-自定义内容</div>',
//            domLoad    : '<div class="dropload-load"><span class="loading"></span>加载中-自定义内容...</div>'
//        },
//        domDown : {
//            domClass   : 'dropload-down',
//            domRefresh : '<div class="dropload-refresh">刷新</div>',
//            domLoad    : '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
//            domNoData  : '<div class="dropload-noData">无数据</div>'
//        },
        loadDownFn : function(me){
            page++;
            $.ajax({
                url:'{:url("First/ajaxvolunteer")}',
                data:'page='+page,//
                type:'POST',
                dataType:'JSON',
                success: function(data){
                    var arrLen = data.msg.length;
                    if(arrLen<=0){

                        me.lock();
//                         无数据
                        me.noData(true);
                        // 每次数据加载完，必须重置
                        me.resetload();
                    }else{
                        var datas = data.msg;
                        $.each(datas,function(key,v){
                            var _html='';

                           _html +='<div class="card" style="margin-top:0.8rem;" id='+v.user_id+'>';
                            _html +='<div class="top underLine">';
                            _html +='<div class="head">';
                            _html +='<img src='+v.user_image+' alt=""></div>';
                            _html +='<div class="name">';
                            _html +='<div class="username">'+v.user_username+' </div>';
                            _html +='<div class="tuandui">'+v.mechanism+'</div>';
                            _html += '</div></div>';
                            _html += '<div class="under"> <div class="font aui-ellipsis-2">参加活动：'+v.activity+'';
                            _html +='</div> </div> </div>';
                            $(".upOrDown_data").append(_html);

                        });
                        // 每次数据加载完，必须重置
                        me.resetload();
                    }
                    $('.card').click(function () {
                        var id = $(this).attr('id');
                        location.href='{:url("First/volunteerdetail")}?user_id='+idd;
                    });
                },
                error: function(xhr, type){
                    alert('Ajax error!');
                    // 即使加载出错，也得重置
                    me.resetload();
                }
            });
        },
        loadUpFn : function(me){
            page = 1;
            $.ajax({
                url:'{:url("First/ajaxvolunteer")}',
                data:'page='+page,
                type:'POST',
                dataType:'json',
                success: function(data){
                    $('.upOrDown_data').empty();//
                    var datas = data.msg;
                    $.each(datas,function(key,v){
                        var _html='';

                        _html +='<div class="card" style="margin-top:0.8rem;" id='+v.volunteer_id+'>';
                        _html +='<div class="top underLine">';
                        _html +='<div class="head">';
                        _html +='<img src="'+v.user_image+'" alt=""></div>';
                        _html +='<div class="name">';
                        _html +='<div class="username">"'+v.user_username+'" </div>';
                        _html +='<div class="tuandui">"'+v.mechanism+'"</div>';
                        _html += '</div></div>';
                        _html += '<div class="under"> <div class="font aui-ellipsis-2">参加活动："'+v.activity+'"';
                        _html +='</div> </div> </div>';
                        $(".upOrDown_data").append(_html);
                    });
                    me.resetload();
                    me.unlock();
                    me.noData(false);
                    $('.card').click(function () {
                        var id = $(this).attr('id');
                        location.href='{:url("First/volunteerdetail")}?user_id='+idd;

                    });
                },
                error: function(xhr, type){
                    alert('Ajax error!');
                    me.resetload();
                }
            });
        }
    });
</script>
</html>
